package news_create_config

import (
	"errors"
	createConfigDto "news_for_deepseek_interface/dto/admin/news/create_config"
	"news_for_deepseek_interface/model"
	"news_for_deepseek_interface/model/news"
)

func Delete(params createConfigDto.DeleteRequest) error {

	for _, v := range params.Id {
		var newsCreateConfig news.NewsCreateConfig
		db := model.GetInstance().GetDB()
		if err := db.Where("id = ?", v).First(&newsCreateConfig).Error; err != nil {
			return errors.New("配置不存在")
		}

		db.Where("id = ?", v).Delete(&news.NewsCreateConfig{})
	}

	return nil
}
